package todlu.RssReader.RSS;

import todlu.RssReader.CommonParameters;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

public class GetRssThread extends Thread {
	private Handler handler;
	private RssFeed feed;
	private int id;
	
	public GetRssThread(Handler handler, RssFeed feed, int id)
	{
		this.handler = handler;
		this.feed = feed;
		this.id = id;
	}
	
	@Override
	public void run()
	{
		boolean res = feed.update();
		
		Message msg = new Message();
		Bundle bundle = new Bundle();
		
		bundle.putString("Title", feed.getTitle());
		bundle.putBoolean("Success", res);
		bundle.putInt("ID", id);
		msg.setData(bundle);
		
		msg.what = CommonParameters.LOAD_FEED_END;
		handler.sendMessage(msg);
		super.run();
	}
}
